<extend name="Public:template" />
<block name="page_header">
	<include file="Public:header_with_title"/>
</block>
<block name="page_body">
<div class="row mt20">
	<div class="span20" id="stepOrder">
		<ul class="nav nav-tabs">
			<li class="disabled"><a href="#"><h4>第一步：我的购物车</h4></a></li>
			<li class="active"><a href="{:U('CustOrder/showConfirm')}"><h4>第二步：选择配送地址</h4></a></li>
			<li class="disabled"><a href="#"><h4>第三步：等待收货</h4></a></li>
		</ul>
	</div>
	<div class="span10 mt-10">
		<table class="table table-bordered prodList">
			<tr class="alert-info">
				<th >商品清单</th>
				<th>规格</th>
				<th>价格</th>
				<th>数量</th>
			</tr>
			<volist name="cartItems" id="val">
			<tr>
				<td class="text-left">{$i}.{$val.name} </td>
				<td><label class="label label-info">{$val.spec|m_prod_spec=$val['spec_qty'],$val['spec_unit']}</label></td>
				<td class="text-right">¥{$val.price_real}</td>
				<td>{$val.num}</td>
			</tr>
			</volist>
			<tr>
				<td colspan="4" class="text-right price">
					您购买了<span class="text-danger" >{$cartPrice.total_item}</span>种商品，总共<span class="text-danger" >{$cartPrice.total_num}</span>件，商品总价：<span class="now">¥{$cartPrice.total_amt|number_format=###, 2,'.',''}</span>
				</td>
			</tr>
			<tr>
				<td colspan="4" class="text-right price">
					<if condition="$cartPrice['send_fee'] == 0">
						免费配送
					<else/>
						配送费用：<span class="now">¥{$cartPrice.send_fee|number_format=###, 2,'.',''}</span>
					</if>
				</td>
			</tr>
		</table>
		
	</div>
	<div class="span10 mt-10">
		<form action="{:U('CustOrder/doOrder')}" method="post" id="form_add" name="form_add" role="form">
			<input type="hidden" name="address_add_flag" value="{$address.add_flag}">
			
			<div class="input-prepend">
				<span class="btn btn-warning"><span class="icon-user"></span></span>
				<input type="text"  name="cust_name" placeholder="请输入收货人姓名" style="padding-left:5px;" value="{$address.name}">
			</div>
			<div class="input-prepend">
				<span class="btn btn-warning"><span class="icon-hdd"></span></span>
				<input type="text"  name="cust_mobile" placeholder="请输入收货人手机或电话" style="padding-left:5px;" value="{$address.mobile}">
			</div>
			<div class="input-prepend">
				<span class="btn btn-warning"><span class="icon icon-home"></span></span>
				<input type="text" class="input-xxlarge"  name="cust_address" placeholder="请输入您的收货地址" style="padding-left:5px;" value="{$address.address}">
			</div>
			<div class="input-prepend">
				<span class="btn btn-warning"><span class="icon icon-time"></span></span>
				<select name="cust_free_time" style="padding-left:5px" >
					<volist name="sendTime" id="val">
						<option value="{$val.title}">{$val.title}</option>
					</volist>
				</select>
			</div>
			<div class="input-prepend">
				<span class="btn btn-warning"><span class="icon icon-file"></span></span>
				<textarea name="cust_bak" class="input-xxlarge" rows=5 placeholder="如果有特殊说明或要求可在这里填写">{$address.content}</textarea>
			</div>
			<div class="alert alert-success">
				普通订单：默认配送时间均为当日时间，如果需要延后配送，请在备注中说明
			</div>
			<button type="button"  class="btn btn-default btn-large mt5 pull-left" onclick="redirect('{:U('Cart/index')}')"><span class="icon icon-shopping-cart"></span>返回修改</button>
			<button type="button"  class="btn btn-danger btn-large mt5 pull-right" onclick="doOrder()"><span class="icon-white icon-hand-right"></span>提交订单</button>
		</form>
	</div>
	
</div>
<br><br><br><br>
</block>
<block name="script_footer">
<script type="text/javascript">
function doOrder(){
	var formObj = document.forms["form_add"];
	var formElsObj = formObj.elements;
	if(formElsObj['cust_name'].value==''){
		alert('收货人名称不能为空');
		return false;
	}
	if(formElsObj['cust_mobile'].value==''){
		alert('联系电话或手机不能为空');
		return false;
	}
	if(formElsObj['cust_address'].value==''){
		alert('配送地址不能为空');
		return false;
	}
	formObj.submit();
}
</script>
</block>
